<template>
    <div ref="loop">
        <div class="swiper-wrapper">
            <slot name="slide"></slot>
        </div>
        <!-- 如果需要分页器 -->
        <slot name="pagination"></slot>
        <slot></slot>
    </div>
</template>

<script>
import Swiper from 'swiper';
export default {
    props:{
        options:{
            type:Object,
            default(){
                return {};
            }
        },
        SwiperData:{
            type:Array,
            default(){
                return [];
            }
        }
    },
    watch: {
        SwiperData(){
            this.$nextTick(()=>{
                this.$swiper.update();
            })
        }
    },
    methods: {
        initSwiper(){
          this.$swiper = new Swiper(this.$refs.loop,this.options);
        }
    },
    mounted() {
        this.initSwiper();
    },
}
</script>